package com.anolesoft.twelvePlan.controller;

import com.anolesoft.common.core.domain.LoginUser;
import com.anolesoft.common.core.web.domain.AjaxResult;
import com.anolesoft.twelvePlan.dto.PartZhouZhuanDTO;
import com.anolesoft.twelvePlan.service.PartZhouZhuanService;
import com.anolesoft.twelvePlan.vo.PartZhouZhuanQueryVO;
import com.anolesoft.yr.util.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zyq
 * @date 2022/10/12
 */
@RestController
@RequestMapping(value="/plan/zhouZhuan")
@Slf4j
public class PartZhouZhuanController {
    @Autowired
    private PartZhouZhuanService partZhouZhuanService;

    @PostMapping(value = "/query")
    public AjaxResult queryZhouZhuan(@RequestBody PartZhouZhuanQueryVO queryVO) {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        queryVO.setFactoryId(loginUser.getFacCode());
        log.debug("日期区间与厂代号：{}", queryVO);
        List<PartZhouZhuanDTO> partZhouZhuanDTOS = this.partZhouZhuanService.queryZhouZhuan(queryVO);
        return AjaxResult.success("查询成功",partZhouZhuanDTOS);
    }

}
